/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.nct.BlockingQueue;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;
import org.nct.StaticVariable.StaticVariable;

/**
 *
 * @author annn
 */
public class BlockingQueueMemCached {

    public BlockingQueueMemCached(BlockingQueue q) {
        this.q = q;
    }

    /**
     *
     */
    BlockingQueue q;

    public BlockingQueueMemCached() {
        q = new LinkedBlockingDeque(StaticVariable.sizequeue);
    }

    public synchronized void Add(Object obj) throws InterruptedException {
        q.put(obj);
        //org.nct.logger.MyLogger.getInstance().Info("Add Queue");
    }

    public synchronized Object Get() throws InterruptedException {
        // org.nct.logger.MyLogger.getInstance().Info("Get Queue");
        return q.take();
    }

    public boolean isEmpty() {
        return q.isEmpty();
    }

    public boolean Contains(Object obj) {
        return q.contains(obj);
    }
}
